﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using DeyuMvc.Dbs;
using DeyuMvc.Models;

namespace DeyuMvc.Controllers
{
    public class GradeController : Controller
    {
        GradeBll bll = new GradeBll();
        // GET: Grade
        public ActionResult Index()
        {
            var list = bll.GetAll();

            return View(list);
        }

        // GET: Grade/Details/5
        public ActionResult Details(string id)
        {
            var obj = bll.GetByKey(id);

            return View(obj);
        }

        // GET: Grade/Create
        public ActionResult Create()
        {
            var obj  = new  Grade();

            return View(obj);
        }

        // POST: Grade/Create
        [HttpPost]
        public ActionResult Create(Grade obj)
        {
            try
            {
                // TODO: Add insert logic here
                obj.IdGrade = DBCommon<>


                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }

        // GET: Grade/Edit/5
        public ActionResult Edit(int id)
        {
            return View();
        }

        // POST: Grade/Edit/5
        [HttpPost]
        public ActionResult Edit(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add update logic here

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }

        // GET: Grade/Delete/5
        public ActionResult Delete(int id)
        {
            return View();
        }

        // POST: Grade/Delete/5
        [HttpPost]
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add delete logic here

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
    }
}
